package org.ricks.db;

/**
 * @author chenwei
 * @Title:
 * @Package
 * @Description:
 * @date 2020/12/2316:48
 */
public class StringEnumPropertyHandler implements PropertyHandler {
    public StringEnumPropertyHandler() {
    }

    public boolean match(Class<?> parameter, Object value) {
        return value instanceof String && parameter.isEnum();
    }

    public Object apply(Class<?> parameter, Object value) {
        return Enum.valueOf(parameter.asSubclass(Enum.class), (String)value);
    }
}